package com.canbot.u05.activity.customvoice;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;

import com.alibaba.fastjson.JSON;
import com.canbot.u05.R;
import com.canbot.u05.activity.BaseActivityNoTitle;
import com.canbot.u05.activity.customvoice.adapter.CustomDialogScreenAdapter;
import com.canbot.u05.activity.customvoice.bean.CustomDialogExcelData;
import com.canbot.u05.socket.MsgSendUtils;
import com.canbot.u05.socket.MsgType;
import com.canbot.u05.utils.PathConst;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by liu.heng  on 2018/5/24.
 * Excel导入重复信息显示
 */
public class CustomDialogScreenActivity extends BaseActivityNoTitle {

        private RecyclerView mListView;

        private CustomDialogScreenAdapter mCustomDialogScreenAdapter;

        private List<CustomDialogExcelData> mCustomDialogScreenData;

        @Override
        protected void onCreate(Bundle savedInstanceState) {
                super.onCreate(savedInstanceState);
                setContentView(R.layout.activity_custom_dialog_screen);
                initView();
        }

        private void initView() {
                mListView = (RecyclerView) findViewById(R.id.my_listView);
                mListView.setLayoutManager(new LinearLayoutManager(this));
                getData();
                mCustomDialogScreenAdapter = new CustomDialogScreenAdapter(this, mCustomDialogScreenData);
                mListView.setAdapter(mCustomDialogScreenAdapter);
        }

        private void getData() {
                mCustomDialogScreenData = new ArrayList<>();
                final Intent intent = getIntent();
                final String samaData = intent.getStringExtra("samaData");
                mCustomDialogScreenData = JSON.parseArray(samaData, CustomDialogExcelData.class);
        }

        @Override
        protected void onResume() {
                super.onResume();
                MsgSendUtils.sendStringMsg(MsgType.PLAY_SOUND, PathConst.CUSTOM_DIALOG_PAYH + "u05_wtcf_001.wav");
                MsgSendUtils.sendStringMsg(MsgType.EYE_MOTION, "43");
                MsgSendUtils.sendStringMsg(MsgType.ACTION, "14006");
        }

        /*返回*/
        public void back(View view) {
                finish();
        }
}
